package dao;

import server.FruitsService;


import java.util.Objects;

public class Strawberry extends Fruits {

    public Strawberry(String type, int count, Double money, Double discount) {
        super(type, count, money, discount);
    }

    public Double calculationStrawberry(FruitsService fruitsService, Fruits fruits) {
        Double result = fruitsService.SingleFruits(fruits.getCount(), fruits.getMoney());
        if (!Objects.equals(fruits.getDiscount(), 1.0)) {
            result = fruitsService.DiscountFruits(result, fruits.getDiscount());
        }
        return result;
    }


}
